{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Principal Component Analysis "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Eigenvalues: [0.74992815+0.j 3.67612927+0.j 8.27394258+0.j]\n",
      "Eigenvector: [[-0.70172743  0.69903712 -0.1375708 ]\n",
      " [ 0.70745703  0.66088917 -0.25045969]\n",
      " [ 0.08416157  0.27307986  0.95830278]]\n",
      "Sorted and Selected Eigen Values: [8.27394258+0.j 3.67612927+0.j]\n",
      "Sorted and Selected Eigen Vector: [[-0.1375708   0.69903712]\n",
      " [-0.25045969  0.66088917]\n",
      " [ 0.95830278  0.27307986]]\n",
      "Principal Components: [[-2.15142276 -0.17311941]\n",
      " [ 3.80418259 -2.88749898]\n",
      " [ 0.15321328 -0.98688598]\n",
      " [-4.7065185   1.30153634]\n",
      " [ 1.29375788  2.27912632]\n",
      " [ 4.0993133   0.1435814 ]\n",
      " [-1.62582148 -2.23208282]\n",
      " [ 2.11448986  3.2512433 ]\n",
      " [-0.2348172   0.37304031]\n",
      " [-2.74637697 -1.06894049]]\n"
     ]
    }
   ],
   "source": [
    "# Import numpy \n",
    "import numpy as np\n",
    "\n",
    "# Import linear algebra module\n",
    "from scipy import linalg as la\n",
    " \n",
    "# Create dataset\n",
    "data=np.array([[7., 4., 3.],\n",
    "               [4., 1., 8.],\n",
    "               [6., 3., 5.],\n",
    "               [8., 6., 1.],\n",
    "               [8., 5., 7.],\n",
    "               [7., 2., 9.],\n",
    "               [5., 3., 3.],\n",
    "               [9., 5., 8.],\n",
    "               [7., 4., 5.],\n",
    "               [8., 2., 2.]])\n",
    " \n",
    "# 1. Calculate the covariance matrix\n",
    "# Center your data\n",
    "data -= data.mean(axis=0)\n",
    "cov = np.cov(data, rowvar=False)\n",
    " \n",
    "# 2. Calculate  eigenvalues and eigenvector of the covariance matrix\n",
    "evals, evecs = la.eig(cov)\n",
    "print(\"Eigenvalues:\", evals)\n",
    "print(\"Eigenvector:\", evecs)\n",
    " \n",
    "# 3. Multiply the original data matrix with Eigenvector matrix. \n",
    "# Sort the Eigen values and vector and select components\n",
    "num_components=2\n",
    "sorted_key = np.argsort(evals)[::-1][:num_components]\n",
    "evals, evecs = evals[sorted_key], evecs[:, sorted_key]\n",
    "print(\"Sorted and Selected Eigen Values:\", evals)\n",
    "print(\"Sorted and Selected Eigen Vector:\", evecs)\n",
    " \n",
    "# Multiply original data and Eigen vector\n",
    "principal_components=np.dot(data,evecs)\n",
    "print(\"Principal Components:\", principal_components)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   principal_component_1  principal_component_2\n",
      "0               2.151423              -0.173119\n",
      "1              -3.804183              -2.887499\n",
      "2              -0.153213              -0.986886\n",
      "3               4.706518               1.301536\n",
      "4              -1.293758               2.279126\n",
      "5              -4.099313               0.143581\n",
      "6               1.625821              -2.232083\n",
      "7              -2.114490               3.251243\n",
      "8               0.234817               0.373040\n",
      "9               2.746377              -1.068940\n"
     ]
    }
   ],
   "source": [
    "# Import pandas and PCA\n",
    "import pandas as pd\n",
    "\n",
    "# Import principal component analysis\n",
    "from sklearn.decomposition import PCA\n",
    " \n",
    "# Create dataset\n",
    "data=np.array([[7., 4., 3.],\n",
    "               [4., 1., 8.],\n",
    "               [6., 3., 5.],\n",
    "               [8., 6., 1.],\n",
    "               [8., 5., 7.],\n",
    "               [7., 2., 9.],\n",
    "               [5., 3., 3.],\n",
    "               [9., 5., 8.],\n",
    "               [7., 4., 5.],\n",
    "               [8., 2., 2.]])\n",
    " \n",
    "# Create and fit PCA Model\n",
    "pca_model = PCA(n_components=2)\n",
    "components = pca_model.fit_transform(data)\n",
    " \n",
    "components_df = pd.DataFrame(data = components, \n",
    "                                       columns = ['principal_component_1', 'principal_component_2'])\n",
    "print(components_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Finding Number of Clusters"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The Elbow Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEWCAYAAABMoxE0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3dd3xc1Zn/8c9X3UXGvdsSYEIPBmxjGza0JJiEAIGQUG2y+aUtCUvCZgkpQHbDpmwq6aQspkMCJIQAocQhATdsY7BpsYPl3o0tuUiypOf3xz2yx/JodFVGdyQ979frvmbm1mfu3Jln7rnnniMzwznnnGurvKQDcM4517V5InHOOdcunkicc861iycS55xz7eKJxDnnXLt4InHOOdcu3SaRSDJJ47Kw3p2SDuvo9WaLpCckzUg6jqRJKg/HREFC2z9V0rJw/FzYhuVvkXR3NmLLNUkds5L+Kun/hedXS3q+s2PIho58L5LOkLSmpflyKpFIOk3SbEk7JG2T9IKkiZ24/X0HViMz62tmb2Vpe8dIejS83ypJsyRNbcXyB/3YmNm5Zjaz46Ntn3Bwm6QvNBm/RtIZCYWVTf8F/DgcP79PN4OkyyUtCMlmffhBPa2jAkg6mcaVrWM2/Ag2hP2bOkzp6G21Rfi9MUknNBn/+zD+jBjryInPOGcSiaR+wGPAj4CBwCjga0BNknFli6TDgReAJcChwEjgEeCpXDnQs2AbcEP4rLuMNn5Jy4BXM6zz88APgP8BhgFjgZ8CF7QlxmxI+sepg6wLyTx1mJN0UCn+AUxvfCFpEDAZ2JxYRG1hZjkxABOA7S3M86/A68DbwJ+BspRpBowL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fT/vJzr7OxlYKCld6cRGomKt70s6M8105wBPJC4Hmdk24EGiZNKogv0/xBcQGrhspUsk5YXrJocBbwJ/JmqMrxD21azqk2klRGcup0saHC5cXwY818Iy9wJTJb2/cYSkaZKObzJfBVEXzCjqe/vQ8HwksNvM7ga+0zgPUEXU/TDAXODUUGSHpN6S3tE0EEl5wBgzm0XUmVN/oG+6oEMCuwi4W9L4Ft6j66E8kbhc9V0gtfbWL4l+vOcDp9D82UImbxL94D8BfMrMqom6Vn0NWCRpKfALWrh2GJrovhGYBbwMLDKzP7SwzB7gPOCzkpZJeg24mqj3wlQPAQND0dSnifqnBzgemB/Gfxn4ehh/O/CEpFlmtjms8z5JrxAllqPShJNPlBiWAC8B3w99ljQX+4tELco+2qTygnOAt/7rnHOunfyMxDnnXLt4InHOOdcunkicc861iycS55xz7eKJxDnnXLt4InHOOdcunkicc861y/8HIbp/1NNBqTYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas\n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# import K-means \n",
    "from sklearn.cluster import KMeans\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "wcss_list = []\n",
    "# Run a loop for different value of number of cluster\n",
    "for i in range(1, 6):\n",
    "    # Create and fit the KMeans model\n",
    "    kmeans_model = KMeans(n_clusters = i, random_state = 123)\n",
    "    kmeans_model.fit(data)\n",
    "    # Add the WCSS or inertia of the clusters to the score_list\n",
    "    wcss_list.append(kmeans_model.inertia_)\n",
    "\n",
    "# Plot the inertia(WCSS) and number of clusters    \n",
    "plt.plot(range(1, 6), wcss_list,  marker='*')\n",
    "# set title of the plot\n",
    "plt.title('Selecting Optimum Number of Clusters using Elbow Method')\n",
    "# Set x-axis label\n",
    "plt.xlabel('Number of Clusters K')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Within-Cluster Sum of the Squares(Inertia)')\n",
    "# Display plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Silhouette Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAeRklEQVR4nO3de7gcVZ3u8e9LAEFAEBMFkkAiBjFeyMEQQBDBESdcNOqABlAGR8E4A4iiI6jj4O0cGI/KOKAxMgwqAoc5oGYkXDzIRUUwCQJJuGiM0cSohPtFhAl5zx9VG5tO770rya7u7NT7eZ5+0qtqVdWvV5L+9VpVtUq2iYiI5tqk1wFERERvJRFERDRcEkFERMMlEURENFwSQUREwyURREQ0XBJBdJ2kYyRd01K2pJeU7y+Q9NneRddcafvmSiKIWkjaX9JNkh6W9ICkn0jaC8D2t22/sdcxtpJ0vaT3ti17JkGt4z6nSbpN0iOS7pN0raRx6xvr+ig/558lPVbGdLmkHddhP+vVNrFhSSKIISfpecD3gX8DtgdGA58CnuxlXN1Ufkl+EzgV2BYYD3wFWD2Ex5Ckdfk/fKLtrYHdgO2ALw1VTDE8JRFEHXYDsH2x7adtP2H7Gtt3AEg6TtKPB9j++ZKukPSopFsk7dq3QtJrJM0texpzJb2mZd1SSW9oKZ8h6cKW8j5lL+UhSbdLOrBc/jngtcA55S/lcyTdWG52e7nsHWXdw8tf+Q+V+3pVP59hEvBr29e68Kjty2z/ttzPCEkfk/Sr8nPOlzS2wme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      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# import k-means for performing clustering\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# import silhouette score\n",
    "from sklearn.metrics import silhouette_score\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "score_list = []\n",
    "\n",
    "# Run a loop for different value of number of cluster\n",
    "for i in range(2, 6):\n",
    "    # Create and fit the KMeans model\n",
    "    kmeans_model = KMeans(n_clusters = i, random_state = 123)\n",
    "    kmeans_model.fit(data)\n",
    "    \n",
    "    # Make predictions\n",
    "    pred=kmeans_model.predict(data)\n",
    "    \n",
    "    # Calculate the Silhouette Score\n",
    "    score = silhouette_score (data, pred, metric='euclidean')\n",
    "    \n",
    "    # Add the Silhouette score of the clusters to the score_list\n",
    "    score_list.append(score)\n",
    "    \n",
    "# Plot the Silhouette score and number of cluster    \n",
    "plt.bar(range(2, 6), score_list)\n",
    "# Set title of the plot \n",
    "plt.title('Silhouette Score Plot')\n",
    "# Set x-axis label\n",
    "plt.xlabel('Number of Clusters K')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Silhouette Scores')\n",
    "# Display plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## K-Means Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6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S9IJWh6UdEvU8DU7HbPlh8C4iFgk6SjgP0lGM22vHrM2eY/fmsFhJJfsj670oKReJJe+3xzJaIcPAYcCpF0xJ5NMDvOjiPhnhZd4HLg2Hd11dfmD6YfNLcCRacCPAe4CRPIh8zjwPyRjqw+tcZt2SbfnbkmPAeewbt6CNusxa4/3+K2hSRpDMvvVPsD9addHD+DWdJEfk/TrDwSeSPfk+wLLgNvSZd4LvEIyfHclHwf2Bw4HzpU0KtZNJLPWDJJwFvDr9JvICcAQknFiVqUjeJZP/7ma9XfA1j4u4MmI+EAH6zGrynv81rDS0QyvIBm3fA5wMTAlIuZGxJj058ck3Tyfj3WjaO4AHJqO3Doc+CrJpBeHSXp/2Tq6AdtHxO9IZtkaBFQ6KPs7YCRwCsmHACQfNgvT0P8wUOlso+eBXSVtlh4UPjhtfxoYIukDaR09JY3aiHrMqnLwWyM7GZgTEXen9y8H3i1p7XC8aydL+Sjr9u6JiKXA/cAnSYbBPSMi5pOM6nilpNK98u7ALyQ9AfwFuDQiXisvJCLeJhlH/R3AzLT5WqBFUitwLMlIseXPmwtcT9p9k65jbffRkcB3JM0iGalx31rrMWuLT+c0MysY7/GbmRWMg9/MrGAc/GZmBePgNzMrGAe/mVnBOPjNzArGwW9mVjD/C2mTrRAnPWadAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import K-means\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Define number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create and fit the KMeans model\n",
    "km = KMeans(n_clusters=num_clusters)\n",
    "km.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=km.predict(data)\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\", cmap=\"bwr_r\")\n",
    "# Set title of the plot \n",
    "plt.title('K-Means Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hierarchical Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEZCAYAAACQK04eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAbLUlEQVR4nO3deZxcZZ3v8c+XBCHsRAJEIES2sFw0SIRBLhJfwBBwFJiBKyDrgEGdOEbxdUXHEXRwZBzXK44YhLCKEgXZ4oIoIIpAwECAEJawk0BYswBBkt/943laK5Xq7krSp053nu/79epX19nq/Op09bee85xT5ygiMDOzcqxRdwFmZtZZDn4zs8I4+M3MCuPgNzMrjIPfzKwwDn4zs8I4+AcYSfdJGtsP6jhB0i09TP+FpOOrXEcby98o6eRVqaEvSNpH0qy666iCpLGSnqq7DlsxDv5+RNJjkvZvGrdM+EXELhFxY8eLW0ERcVBEXFjlOiS9RdIZkh6StChvv/MljezDdazShw9ARPw+Ikb1VU09yR92r0taIGm+pDslnSZprU6s3wYGB38hJA1eiWUGVVFLH/op8EHgaGBD4J3AncB+dRbVaGW2ex+YEBHrA8OBU4EjgamS1Mki+vq117QtV0sO/gGmca9A0hq5NfeIpBckXS5paJ42Ul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uoBl7x7W3XzdaV7+V8DH8h2gkLRDvk9xu3Vvm2/I80XgeWCrdpc164lb/La6GiJpOqm75k3SPQK+maf9D/AzSUcAvwMW5fH3AG9Kuhu4oIf5utO8/HdIZ/rclW8KMg84dAVew3/nYwsCbiDdz9hslfngrplZYdzVY2ZWGAe/mVlhHPxmZoVx8JuZFcbBb2ZWGAe/mVlhHPxmZoX5/yKooyFVak5aAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import dendrogram\n",
    "from scipy.cluster.hierarchy import dendrogram\n",
    "from scipy.cluster.hierarchy import linkage\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    "\n",
    "# create dendrogram using ward linkage\n",
    "dendrogram_plot = dendrogram(linkage(data, method = 'ward'))\n",
    "\n",
    "# Set title of the plot\n",
    "plt.title('Hierarchical Clustering: Dendrogram')\n",
    "\n",
    "# Set x-axis label\n",
    "plt.xlabel('Data Items')\n",
    "\n",
    "# Set y-axis label\n",
    "plt.ylabel('Distance')\n",
    "\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deZxd8/3H8dd7Zj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ZwC3pN5GDgAaSfmIa0x48m9/+cx4L74AtmC7ghYjYrIP1mLXKe/xWtdLeDC8i6bf8HeBcYHREjI+IEenjYpJmnkPj8140VwZ2SntuHQqcQHLTi10lbdJsHTXAShFxH8ldtvoDLR2UvQ9YHTiK5EMAkg+bSWnobwu0dLbR28DaknqmB9lxVCsAAAC6SURBVIW3T8e/AjRI2iyto4ekdb5APWatcvBbNTsMeCci7k6Hfw+sJWlBd7wLbpayM5/v3RMRM4CHgK+RdIN7YkS8R9Kr46WSSvfKa4GrJT0HPAWcHxFTmxcSEU0k/agPBB5MR18DjJQ0DtifpKfY5q8bD1xH2nyTrmNB89HewC8lPUPSU+Pm5dZj1hafzmlmVjDe4zczKxgHv5lZwTj4zcwKxsFvZlYwDn4zs4Jx8JuZFYyD38ysYP4flAO855lzfPIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import Agglomerative Clustering\n",
    "from sklearn.cluster import AgglomerativeClustering\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Specify number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create agglomerative clustering model\n",
    "ac = AgglomerativeClustering(n_clusters = num_clusters, linkage='ward')\n",
    " \n",
    "# Fit the Agglomerative Clustering model\n",
    "ac.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=ac.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\")\n",
    "\n",
    "# Set title of the plot \n",
    "plt.title('Agglomerative Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DBSCAN Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3debxd0/3/8dc7o0xEBhGhibmGUlwxFW2NoUR/+KJFSmuoKh1QraFUJy2+KIJfa1apGqONeZ65IYYkUjEmJRJCkCDT5/fH2vfnujl3733u3Xuf6fN8PM4j9561zt6fc07u+Zy991qfJTPDOeeca0+XSgfgnHOuunmicM45F8sThXPOuVieKJxzzsXyROGccy6WJwrnnHOxPFE4V2GSvifpkUrHASBpsqSvVzoOV108UbiqIel1SZ9I+kjSB5Iek3SkpC6t+lwhaaGkj6N+EyVt36p9VUk3SnpX0jxJL0j6Xqv2HpJOk/SypPnRPi+TNKJNLFdIWixplTb3nybJJO3b6r5u0X1f2Eabx+0i6aEo5jmSHpS0ZyderlL7MElrdWYbZraBmT2QUUiuTniicNVmDzPrBwwH/gj8Avhbmz5/MrO+wArAWOAmSV2jtquBGdHjBwIHA++0euwNwJ7Ad6LHbwxMBHZo6SCpD7A3MA/4bokY5wK/abXPWJL2Af4JXAWsCgwBTgX2SPP4IkjqVukYXPXyROGqkpnNM7PxwH7AGEkbluizFPg7MIDw4QuwOXCFmc03s8Vm9qyZ3Q4gaUdgJ2C0mT0dtc8zswvNrHUy2hv4APgNMKZEeHcAC4EDk56HJAHnAGeY2V+j/S01swfN7LAS/UdERwbdWt33gKQfRD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oIvkN0/zRgsKStoji6S9qgjHica5cnCtdIDgPeNLO7o98vAr4safuWDpJ6A7vw+dEDZjYfeATYg1De+TgL63p8n3CtofW3/q7ANZJeAJ4F/tfMPmgbiJktJawnMJDP1wO5FmiS1Ax8F3ipxONmANcTnU6K9tFyOmsf4ExJzxEqim6dNh7n4vjwWOecc7H8iMI551wsTxTOOedieaJwzjkXyxOFc865WJ4onHPOxfJE4ZxzLpYnCuecc7H+H7vm7qbVBUtYAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import DBSCAN clustering model\n",
    "from sklearn.cluster import DBSCAN\n",
    "\n",
    "# import make_moons dataset\n",
    "from sklearn.datasets import make_moons\n",
    " \n",
    "# Generate some random moon data\n",
    "features, label = make_moons(n_samples = 2000)\n",
    " \n",
    "# Create DBSCAN clustering model\n",
    "db = DBSCAN()\n",
    " \n",
    "# Fit the Spectral Clustering model\n",
    "db.fit(features)\n",
    " \n",
    "# Predict the target variable\n",
    "pred_label=db.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(features[:, 0], features[:, 1], c=pred_label, marker=\"o\",cmap=\"bwr_r\")\n",
    "# Set title of the plot\n",
    "plt.title('DBSCAN Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Spectral Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzL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n4zs4Jx8JuZFYyD38ysYBz8ZmYF4+A3MyuY/w/8qzgy8p8OXgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import Spectral Clustering\n",
    "from sklearn.cluster import SpectralClustering\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Specify number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create Spectral Clustering model\n",
    "sc=SpectralClustering(num_clusters, affinity='rbf', n_init=100, assign_labels='discretize')\n",
    " \n",
    "# Fit the Spectral Clustering model\n",
    "sc.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=sc.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\")\n",
    "# Set title of the plot\n",
    "plt.title('Spectral Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Cluster Performance Evaluation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pregnant</th>\n",
       "      <th>glucose</th>\n",
       "      <th>bp</th>\n",
       "      <th>skin</th>\n",
       "      <th>insulin</th>\n",
       "      <th>bmi</th>\n",
       "      <th>pedigree</th>\n",
       "      <th>age</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>148</td>\n",
       "      <td>72</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>33.6</td>\n",
       "      <td>0.627</td>\n",
       "      <td>50</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>85</td>\n",
       "      <td>66</td>\n",
       "      <td>29</td>\n",
       "      <td>0</td>\n",
       "      <td>26.6</td>\n",
       "      <td>0.351</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8</td>\n",
       "      <td>183</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>23.3</td>\n",
       "      <td>0.672</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>66</td>\n",
       "      <td>23</td>\n",
       "      <td>94</td>\n",
       "      <td>28.1</td>\n",
       "      <td>0.167</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>40</td>\n",
       "      <td>35</td>\n",
       "      <td>168</td>\n",
       "      <td>43.1</td>\n",
       "      <td>2.288</td>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   pregnant  glucose  bp  skin  insulin   bmi  pedigree  age  label\n",
       "0         6      148  72    35        0  33.6     0.627   50      1\n",
       "1         1       85  66    29        0  26.6     0.351   31      0\n",
       "2         8      183  64     0        0  23.3     0.672   32      1\n",
       "3         1       89  66    23       94  28.1     0.167   21      0\n",
       "4         0      137  40    35      168  43.1     2.288   33      1"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Import libraries\n",
    "import pandas as pd\n",
    " \n",
    "# read the dataset\n",
    "diabetes = pd.read_csv(\"diabetes.csv\")\n",
    " \n",
    "    \n",
    "# Show top 5-records\n",
    "diabetes.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# split dataset in two parts: feature set and target label \n",
    "feature_set = ['pregnant', 'insulin', 'bmi', 'age','glucose','bp','pedigree']\n",
    "features = diabetes[feature_set] \n",
    "target = diabetes.label\n",
    " \n",
    "# partition data into training and testing set \n",
    "from sklearn.model_selection import train_test_split\n",
    "feature_train, feature_test, target_train, target_test = train_test_split(features, target, test_size=0.3, random_state=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Davies-Bouldin Index: 0.7916877512521092\n",
      "Silhouette Coefficient: 0.5365443098840619\n",
      "Adjusted Rand Score: 0.03789319261940484\n",
      "Jaccard Score: 0.29411764705882354\n",
      "F-Measure(F1-Score): 0.4545454545454546\n",
      "Fowlkes Mallows Score: 0.6041244457314743\n"
     ]
    }
   ],
   "source": [
    "# Import K-means Clustering\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# Import metrics module for performance evaluation\n",
    "from sklearn.metrics import davies_bouldin_score\n",
    "from sklearn.metrics import silhouette_score\n",
    "from sklearn.metrics import adjusted_rand_score\n",
    "from sklearn.metrics import jaccard_score\n",
    "from sklearn.metrics import f1_score\n",
    "from sklearn.metrics import fowlkes_mallows_score\n",
    " \n",
    "# Specify the number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create and fit the KMeans model\n",
    "km = KMeans(n_clusters=num_clusters)\n",
    "km.fit(feature_train)\n",
    " \n",
    "# Predict the target variable\n",
    "predictions=km.predict(feature_test)\n",
    " \n",
    "# Calculate internal performance evaluation measures\n",
    "print(\"Davies-Bouldin Index:\", davies_bouldin_score(feature_test, predictions))\n",
    "print(\"Silhouette Coefficient:\", silhouette_score(feature_test, predictions))\n",
    "\n",
    "# Calculate External performance evaluation measures\n",
    "print(\"Adjusted Rand Score:\", adjusted_rand_score(target_test, predictions))\n",
    "print(\"Jaccard Score:\", jaccard_score(target_test, predictions))\n",
    "print(\"F-Measure(F1-Score):\", f1_score(target_test, predictions))\n",
    "print(\"Fowlkes Mallows Score:\", fowlkes_mallows_score(target_test, predictions))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
